package com.example.sys.entity.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class LoginUserDto {
    public interface iphoneLogin{};
    public interface emailLogin{};
    /**
     * 用户密码
     */
    @NotBlank(message="密码不能为空")
    private String userPwd;

    /**
     * 手机号
     */
    @Pattern(regexp = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$", message = "手机号不合法", groups = {LoginUserDto.iphoneLogin.class})
    private String iphoneNo;
    /**
     * 邮箱地址
     */
    @Email(regexp = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$", message = "邮箱地址不合法", groups = {LoginUserDto.emailLogin.class})
    private String emailAddress;
}
